<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<head>
<%@ include file="/common/extjs.jsp"%>
<meta name="nav" content="2" />
<meta name="acc" content="2-2" />
<title>添加加班记录</title>
<script type="text/javascript">
$(document).ready(function(){
	$("#startdate").addClass("Wate").bind("click", function(){
		 WdatePicker({skin:'whyGreen',minDate:'1900-10-01', dateFmt:'yyyy-MM-dd '});});
		$("#enddate").addClass("Wate").bind("click", function(){
			 WdatePicker({skin:'whyGreen',minDate:'#F{$dp.$D(\'startdate\')}',dateFmt:'yyyy-MM-dd '});
		     });
		$("#recorddate").addClass("Wate").bind("click", function(){
			 WdatePicker({skin:'whyGreen',minDate:'1900-10-01', dateFmt:'yyyy-MM-dd HH:mm:ss'});});
		//为第一个文本框获得焦点
		  $("#title").focus();
		 //验证
		 $("#inputForm").validate({
			 rules:{
				 deptid:{
					 required:true,
				 },
				 userid:{
					 required:true,
				 },
				 startdate:{
					 required:true,
				 },
				 enddate:{
					 required:true,
				 }
			 },
			 messages:{
				 deptid:{
					 required:"必须填写申请部门！"
				 },
				 userid:{
					 required:"必须填写加班人！"
				 },
				 startdate:{
					 required:"请输入开始时间！"
				 },
				 enddate:{
					 required:"请输入结束时间！"
				 }
				 
			 }
		 });
			$("#usern").click(function() {
				UserNameSelector.getView(function(a, c) {
					$("#usern").val(c);
					$("#userid").val(a);
				}, true).show();
			});
})
</script>
</head>
<body>
<form action="${ctx }/human/overtime!save.action" method="post"
	id="inputForm" class="yform" enctype="multipart/form-data">
	<div id="caption" ><h6>加班记录</h6></div>
<table>
	<tr>
		<td>申请部门</td>
		<td><input id="id" name="id" type="hidden" value="${id}">
		<pt:labels type="insideOrgDept" name="deptid" prompt="全部" default="${overtime.id }"></pt:labels>
		</td>
		<td>加班人</td>
				<c:if test="${empty id }">
					<td><input type="text" name="usern" id="usern" class="choose"
						readonly="readonly"> <input id="userid" name="userid"
						type="hidden" value="${userid}" /></td>
				</c:if>
				<c:if test="${not empty id }">
					<td><input type="text" name="usern" id="usern"
						value='<pt:labels type="user" argument1="${userid }" single="true"></pt:labels>'
						class="choose" readonly="readonly"> <input id="userid"
						name="userid" type="hidden" value="${userid}" /></td>
				</c:if>
	</tr>
	<tr>
		<td>开始时间</td>
		<td><input id="startdate" name="startdate" type="text"
			value="${startdate}"></td>
		<td>结束时间</td>
		<td><input id="enddate" name="enddate" type="text"
			value="${enddate}"></td>
	</tr>
	<tr>
		<td>加班内容,工作量</td>
		<td colspan="3"><textarea name="content" rows="3" >${content }</textarea></td>
	</tr>
	<tr>
		<td>加班类型</td>
		<td><pt:code category="2031" name="type" default="${type }"></pt:code></td>
		<td>是否换休</td>
		<td><pt:code category="1000" name="clear" default="${clear }"></pt:code></td>
	</tr>
	<tr>
		<td>办理人</td>
		<td><input id="recorder" name="recorder" value="${recorder }"></td>
		<td>办理时间</td>
		<td><input id="recorddate" name="recorddate"
			value="${recorddate }"></td>
	</tr>
	<tr>
		<td>备注</td>
		<td colspan="3"><textarea name="remark" rows="3" >${remark }</textarea></td>
	</tr>
</table>
<div class="type-button"><input type="submit" class="submit" value="提交">
	<input type="button" class="reset" onclick="history.back()" value="返回"></div>
</form>
</body>